class Solution:

    def distMoney(self, money: int, children: int) -> int:
        money -= children
        if money < 0:
            return -1

        ans = min(money // 7, children)

        children -= ans

        money -= ans * 7

        if children == 1 and money == 3 or children == 0 and money > 0:
            return ans - 1

        return ans

so = Solution()
print(so.distMoney(20,3))